#ifndef __BASESOCKET_H__
#define __BASESOCKET_H__

#define DATA_COUNT

#ifdef _WIN32
#include <process.h>
#define FD_SETSIZE 1024
#include <winsock2.h>
#include <WS2TCPIP.H>
#include <errno.h>
#pragma comment(lib,"ws2_32.lib")

#include "comdef.h"

class CSocketInitializer
{
public:
	CSocketInitializer(void)
	{
		WORD wVersion; 
		WSADATA wsaData;
		wVersion = MAKEWORD(2,2);
		WSAStartup(wVersion,&wsaData);
	}
	virtual ~CSocketInitializer(void)
	{
		WSACleanup(); 
	}
};
#endif

#define MAX_SOCK_BUFF_LEN 2*1024*1024


class CBaseSocket
{
public:
	CBaseSocket(void);
	~CBaseSocket(void);

	void Close(void);
	void Close(int nSock);
	bool SetNonBlocking(int nSock);
	bool SetNonBlocking(void);
	void SetRcvSndBuff(void);
	void SetRcvSndBuff(int nSock);

	SOCKET GetSocket()
	{
		return m_hSocket;
	}

protected:
	SOCKET	m_hSocket;
};
#endif
